package com.itheima.design.mode.strategy.service;

import org.springframework.stereotype.Component;

@Component
public class PromotionCalculationFactory {

    public PromotionCalculation getPromotionCalculation(String promotion) {

        PromotionCalculation promotionCalculation = null;
        switch (promotion){
            case "p1":
                promotionCalculation = new Promotion1Calculation();
                break;
            case "p2":
                promotionCalculation =  new Promotion2Calculation();
                break;
            case "p3":
                promotionCalculation=  new Promotion3Calculation();
                break;
            case "p4":
                promotionCalculation =  new Promotion4Calculation();
                break;
        }
        return promotionCalculation;
    }

}
